package cn.sccl.dirms.topo.discovery.model;

import cn.sccl.common.exception.BusinessException;
import cn.sccl.common.model.BaseModel;

/**
* 自动发现规则
* 数据库表 T_TOPO_DISCOVER_SCHEDULE 的实体对象
* Created by _minus on 2017-10-09.
*/
public class DiscoverTaskSchedule extends BaseModel{
   /**
   *表名
   */
   public final static String TABLE_NAME ="t_topo_discover_schedule";

    private String taskId;//任务id
    private String type;//任务类型
    private Boolean isRepeat;//是否重复
    private String everyDay;//每天
    private String weekly;//每周
    private String monthly;//每月
    private String sTimeInterval;//以秒计算的间隔
    private String mTimeInterval;//以分钟计算的间隔
    private java.sql.Timestamp startTime;//任务开始时间
    private java.sql.Timestamp endTime;//任务结束时间
    private String cron;//cron表达式

    public void setTaskId(String taskId){
        this.taskId = taskId;
    }

    public String getTaskId(){
        return this.taskId;
    }
    public void setType(String type){
        this.type = type;
    }

    public String getType(){
        return this.type;
    }
    public void setIsRepeat(Boolean isRepeat){
        this.isRepeat = isRepeat;
    }

    public Boolean getIsRepeat(){
        return this.isRepeat;
    }
    public void setEveryDay(String everyDay){
        this.everyDay = everyDay;
    }

    public String getEveryDay(){
        return this.everyDay;
    }
    public void setWeekly(String weekly){
        this.weekly = weekly;
    }

    public String getWeekly(){
        return this.weekly;
    }
    public void setMonthly(String monthly){
        this.monthly = monthly;
    }

    public String getMonthly(){
        return this.monthly;
    }
    public void setSTimeInterval(String sTimeInterval){
        this.sTimeInterval = sTimeInterval;
    }

    public String getSTimeInterval(){
        return this.sTimeInterval;
    }
    public void setMTimeInterval(String mTimeInterval){
        this.mTimeInterval = mTimeInterval;
    }

    public String getMTimeInterval(){
        return this.mTimeInterval;
    }
    public void setStartTime(java.sql.Timestamp startTime){
        this.startTime = startTime;
    }

    public java.sql.Timestamp getStartTime(){
        return this.startTime;
    }
    public void setEndTime(java.sql.Timestamp endTime){
        this.endTime = endTime;
    }

    public java.sql.Timestamp getEndTime(){
        return this.endTime;
    }
    public void setCron(String cron){
        this.cron = cron;
    }

    public String getCron(){
        return this.cron;
    }

    /**
    * clone一个对象。
    * @param cls 需要克隆的对象类型，只能是当前类的子类
    * @param <T>
    * @return
    * @throws IllegalAccessException
    * @throws InstantiationException
    */
    public <T extends DiscoverTaskSchedule> T clone(Class<T> cls) {
       try {
          T t = cls.newInstance();
          t.setId(this.getId());
          t.setDeleteFlag(this.isDeleteFlag());
          t.setCreateTime(this.getCreateTime());
          t.setUpdateTime(this.getUpdateTime());
          /*t.setPosition(this.getPosition());
          t.setUpdateUser(this.getUpdateUser());
          t.setCreateUser(this.getCreateUser());*/
          t.setTaskId(this.getTaskId());
          t.setType(this.getType());
          t.setIsRepeat(this.getIsRepeat());
          t.setEveryDay(this.getEveryDay());
          t.setWeekly(this.getWeekly());
          t.setMonthly(this.getMonthly());
          t.setSTimeInterval(this.getSTimeInterval());
          t.setMTimeInterval(this.getMTimeInterval());
          t.setStartTime(this.getStartTime());
          t.setEndTime(this.getEndTime());
          t.setCron(this.getCron());
          return t;
       } catch (Exception e) {
          e.printStackTrace();
          throw new BusinessException("对象克隆失败，请克隆的目标对象是否具有无参的构造函数。", e.getCause());
       }
    }
}